﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Model;
using BLL;

namespace OASystem.Controllers
{
    public class LoginController : Controller
    {
        //
        // GET: /Login/

        /// <summary>
        /// 登录页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public JsonResult Login2(string Account, string PassWord)// OA_UserAccount account
        {
            OA_UserAccount account = new OA_UserAccount() { Account = Account, PassWord = PassWord };

            var result = new LoginManager().IsLogin(account);

            return Json(result, JsonRequestBehavior.AllowGet);
        }


        /// <summary>
        /// 获取手机验证码
        /// </summary>
        /// <returns></returns>
        public JsonResult GetCode(string Phone)
        {

            try
            {
                var obj = new BLL.LoginManager().GetCode(Phone);

                return Json(obj);
            }
            catch (Exception)
            {
                return Json(new { Code = -1 });
            }

        }
    }
}
